package com.lais.record.common.vo;

import com.lais.record.common.constant.RecordEnum;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @Author: luowen
 * @Description:
 * @Date: Create in 21:50 2019/11/27
 */
@Data
@AllArgsConstructor
public class Result<T> {

    private String code; //响应码

    private String message; //响应信息

    private Boolean flag; //成功标记

    private T data; //响应数据

    public Result(){
    }

    public Result(String code,String message,Boolean flag){
        this.code = code;
        this.message = message;
        this.flag = flag;
    }

    public static Result success(){
        return new Result<>(RecordEnum.SUCCESS.getCode(),RecordEnum.SUCCESS.getMessage(),true);
    }

    public static Result fail(){
        return new Result<>(RecordEnum.FAIL.getCode(),RecordEnum.FAIL.getMessage(),false);
    }
}
